package com.mz.ozy.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mz.ozy.R;
import com.mz.ozy.bean.HomeMerBean;
import com.mz.ozy.bean.OnlineFamilyBean;
import com.mz.ozy.utils.glideUtils.GlideUtils;

import java.util.List;

/**
 * @author lifeStyle on 2020/4/3 0003.
 */
public class BoxBookAdapter extends BaseQuickAdapter<OnlineFamilyBean.RoomListBean, BaseViewHolder> {

    private int mSelectPosition = 0;

    public BoxBookAdapter(List<OnlineFamilyBean.RoomListBean> data) {
        super(R.layout.item_box_book, data);
//        addData(new OnlineFamilyBean.RoomListBean());
//        addData(new OnlineFamilyBean.RoomListBean());
//        addData(new OnlineFamilyBean.RoomListBean());
    }

    @Override
    protected void convert(BaseViewHolder helper, OnlineFamilyBean.RoomListBean item) {
        LinearLayout llBox = helper.getView(R.id.ll_box);
        TextView tvBoxName = helper.getView(R.id.tv_box_name);
        TextView tvBoxSpace = helper.getView(R.id.tv_box_space);
        tvBoxName.setText(item.getName());
        tvBoxSpace.setText("可坐" + item.getMiniman() + "-" + item.getMaxman() + "人");
        if (helper.getAdapterPosition() == mSelectPosition) {
            llBox.setBackgroundResource(R.drawable.bg_stroke_ffdfa1_4dp);
            tvBoxName.setTextColor(mContext.getResources().getColor(R.color.c_efb414));
            tvBoxSpace.setTextColor(mContext.getResources().getColor(R.color.c_efb414));
        } else {
            llBox.setBackgroundResource(R.drawable.bg_stroke_e6e6e6_4dp);
            tvBoxName.setTextColor(mContext.getResources().getColor(R.color.c_aaaaaa));
            tvBoxSpace.setTextColor(mContext.getResources().getColor(R.color.c_aaaaaa));
        }
    }


    public void setSelectPosition(int selectPosition) {
        mSelectPosition = selectPosition;
        notifyDataSetChanged();
    }
}
